﻿@model OrchardCore.Users.ViewModels.ResetPasswordViewModel

@{ 
    ThemeLayout.Metadata.Alternates.Add("Layout__Login");

    ViewData.ModelState.TryGetValue("Email", out var email);
    ViewData.ModelState.TryGetValue("NewPassword", out var newPassword);
    ViewData.ModelState.TryGetValue("PasswordConfirmation", out var passwordConfirmation);
}
<form asp-controller="ResetPassword" asp-action="ResetPassword" method="post">
  <v-card class="px-4">
    <v-card-title>@T["Reset password"]</v-card-title>
    <v-card-subtitle>@T["Set a new password"]</v-card-subtitle>
    <v-card-text>
        @if (ViewData.ModelState.ErrorCount > 0)
        {
          <v-alert color="red" type="error">
            <ul>
              @foreach (var error in ViewData.ModelState.SelectMany(x => x.Value.Errors).Reverse())
              {
                <li>@error.ErrorMessage</li>
              }
            </ul>
          </v-alert>
        }
        <v-row>
          <v-col cols="12">
            <v-text-field id="Email" type="email" name="Email" label="@T["Email"]" value="@email?.AttemptedValue" error-messages="@(email?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
            <v-row>
              <v-col cols="auto">
                <v-text-field id="NewPassword" type="password" name="NewPassword" label="@T["New password"]" error-messages="@(newPassword?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
                <v-text-field id="PasswordConfirmation" type="password" name="PasswordConfirmation" label="@T["New password confirmation"]" error-messages="@(passwordConfirmation?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
              </v-col>
              <v-divider vertical></v-divider>
              <v-col cols="auto">
                <small class="form-text text-secondary">@T["Passwords must have:<br>• 8 characters or more<br>• an uppercase letter<br>• a lowercase letter<br>• a number<br>• a special character"]</small>
              </v-col>
            </v-row>
          </v-col>
        </v-row>
        <input asp-for="ResetToken" type="hidden" />
    </v-card-text>
    <v-card-actions>
      @await RenderSectionAsync("AfterResetPassword", required: false)
      <v-btn type="submit" x-large block color="success">@T["Reset password"]</v-btn>
    </v-card-actions>
  </v-card>
</form>


